// UserViewModel.java
package com.example.ai_basedintelligentdiagnosisandtreatmentofchildren.model;

import android.app.Application;
import androidx.lifecycle.AndroidViewModel;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;

public class UserViewModel extends AndroidViewModel {
    private final MutableLiveData<String> userType = new MutableLiveData<>();
    private final MutableLiveData<Message> user = new MutableLiveData<>();

    public UserViewModel(Application application) {
        super(application);
        // 可以安全使用 application 上下文
    }

    public LiveData<String> getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType.setValue(userType);
    }

    public boolean isParent() {
        if(userType.getValue() == "parent") {
            return true;
        }else{
            return false;
        }
    }

    public boolean isDoctor() {
        if(userType.getValue() == "doctor") {
            return true;
        }else{
            return false;
        }
    }
}